﻿#include "typeConver.h"

typeConver::typeConver()
{

}

QString typeConver::ChararryToQString(const char *ch)
{
//    QString QStr = QString(QLatin1String(ch));//英文
    QString QStr = QString::fromUtf8(ch);//中文字符
    return QStr;
}

char *typeConver::QStringToChararry(const QString QStr)
{
    char *ch = nullptr;
    QByteArray tempString = QStr.toLocal8Bit();
    ch = (char *)malloc(tempString.length() + 1);
    memset(ch,0,tempString.length());
    memcpy(ch,tempString.data(),tempString.length());
    ch[tempString.length()] = '\0';
    return ch;
}
